<?php
/**
 * Modified TestHelper for the EventManager application
 * 
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @author 	   Keith Pope
 */

/**
 * Get PHPUnit
 */
require_once 'PHPUnit/Autoload.php';




/*
 * Set error reporting level
 */
error_reporting( E_ALL | E_STRICT );

/**
 * Default timezone
 */
date_default_timezone_set('Europe/Amsterdam');

/*
 * Set the include path
 */
$root  = realpath(dirname(__FILE__) . '/../');

$paths = array(
    "$root/library/Incu",
    "$root/library",
    "$root/tests",
    "$root/application"
);
set_include_path(get_include_path() . PATH_SEPARATOR . implode(PATH_SEPARATOR, $paths));

defined('APPLICATION_PATH')
    or define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

defined('APPLICATION_ENV')
or define('APPLICATION_ENV', 'development');

require_once 'Zend/Application.php';

/**
 * Autoloader helpers
 */
function _SF_Autloader_SetUp() 
{
    require_once 'Zend/Loader/Autoloader.php';
    
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('SF_');
   
    $application = new Zend_Application(
    		APPLICATION_ENV,
			APPLICATION_PATH.'/configs/events.ini'
	);
    $application->bootstrap();
    clearstatcache();
}

function _SF_Autloader_TearDown()
{
    Zend_Loader_Autoloader::resetInstance();
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('SF_');
}

/**
 * Init autoloader
 */
_SF_Autloader_SetUp();

/**
 * Start session now!
 */
Zend_Session::$_unitTestEnabled = true;
Zend_Session::start();


//PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist("$root/tests");
PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist("$root/library/Zend");